<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Three.js Click and Focus with Animation Demo</title>
    <style>
        body { margin: 0; }
        canvas { display: block; }
    </style>
</head>
<body>
<script src="https://cdn.jsdelivr.net/npm/three@0.132.2/build/three.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tween.js/18.6.4/tween.umd.js"></script>
<script>
    // 创建场景
    var scene = new THREE.Scene();

    // 创建相机
    var camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
    camera.position.z = 5;

    // 创建渲染器
    var renderer = new THREE.WebGLRenderer();
    renderer.setSize(window.innerWidth, window.innerHeight);
    document.body.appendChild(renderer.domElement);

    // 创建粒子系统
    var particleCount = 1000;
    var particles = new THREE.BufferGeometry();
    var positions = new Float32Array(particleCount * 3);

    for (var i = 0; i < particleCount; i++) {
        positions[i * 3] = Math.random() * 10 - 5;
        positions[i * 3 + 1] = Math.random() * 10 - 5;
        positions[i * 3 + 2] = Math.random() * 10 - 5;
    }

    particles.setAttribute('position', new THREE.BufferAttribute(positions, 3));

    var particleMaterial = new THREE.PointsMaterial({ color: 0xffffff, size: 0.1 });
    var particleSystem = new THREE.Points(particles, particleMaterial);

    scene.add(particleSystem);

    // 渲染循环
    function render() {
        requestAnimationFrame(render);
        particleSystem.rotation.x += 0.01;
        particleSystem.rotation.y += 0.01;
        renderer.render(scene, camera);
    }

    render();


</script>
</body>
</html>
